import { mapGetters } from "vuex";
export default{
    computed:{
        ...mapGetters('cart',['getTotal'])
    },
    onShow() {
        this.setTabBarbadge()
    },
    watch:{
        getTotal(){
            this.setTabBarbadge()
        }
    },
    methods: {
        setTabBarbadge(){
         if(this.getTotal>0){
            uni.setTabBarBadge({
                index: 2,
                text: ''+this.getTotal
            })
         }else{
             uni.removeTabBarBadge({ index: 2 })
         }
        }
    },
}